﻿using CommunityToolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WPFTemplate.Model;
using WPFTemplate.TemplateDic;

namespace WPFTemplate.ViewModel
{
    public class MainViewModel:ObservableObject
    {
        public string Title { get; set; }

        public ValueModel ValueModel { get; set; }

        public List<Student> Students { get; set; }

        public ViewModelBase Person { get; set; }

        public List<Person> AllPerson
        {
            get;
            set;
        }

        public MainViewModel(string typeName)
        {
            ValueModel = new StringValueModel();

            var instanceFactory = new ViewModelTypeDic();
            var viewModel = instanceFactory.CreateInstance(typeName) ;
            Person = viewModel;
            Title = Person.TitleName;
        }
    }

    public class Student
    {
        public string Name { get; set; }

        public Student(string name)
        {
            Name = name;
        }
    }
}
